<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>订单</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<meta http-equiv="expires" content="0">
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<link href="../../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="../../css/reset.css" />
		<link rel="stylesheet" href="../../css/cmms.css" />
		<link rel="stylesheet" href="../../css/iconfont.css?time=20190123" />
		<link rel="stylesheet" href="../../css/mui.picker.min.css" />
		<link rel="stylesheet" href="../../css/sale/order/order.css?time=20190123" />
		<script src="../../js/vconsole.min.js"></script>
	</head>

	<body>
		<div id="order" v-cloak>
			<div class="orderList">
				<!--首页今日订单进入-->
				<ul class="orderListItem" v-for="list in orderList">
					<div class="detail" @tap="reportDetail(list.orderId)">
						<li class="row1">
						<span class="name">{{list.patientName}}</span>
						<span class="date">{{list.submitTime|replaceT}}</span>
						<span class="right basic-color">
							<i class="icon iconfont icon-shijian"></i>
							{{list.orderState+""|format}}
						</span>
					</li>
					<li class="row2">
						检验条形码：<span>{{list.specimenBarCode.join(',')}}</span>
					</li>
					<li class="row3">
						<span>{{list.projectNmae.join(',')}}</span>
					</li>
					<li class="row4">
						<span>共<span class="basic-color">{{list.projectNum}}</span>个检验项目
						<!-- <span class="basic-color">¥{{list.amount}}</span> -->
						</span>
						<span class="right">
							<i class="icon iconfont icon-icon1 basic-color"></i>
							{{list.doctorName}}
						</span>
					</li>
					</div>
					<li class="row6" >
						<p></p>
						<p>
							<span class="saler">业务员:{{list.saleName}}</span>
						</p>
					</li>
				</ul>
			</div>
			<!--未找到数据-->
			<div class="notFind" v-if="!orderList">
				<img src="../../img/notFind.png" alt="未找到对应的数据" />
				<p>暂无数据</p>
			</div>
		</div>
	
		<script src="../../js/mui.min.js"></script>
		<script src="../../js/vue.js"></script>
		<script src="../../js/mui.picker.min.js"></script>
		<script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
		<script src="../../js/cmms.js?time=222"></script>
		<script type="text/javascript">
			mui.init()
		</script>
		<script type="text/javascript">
			new Vue({
				el:"#order",
				data:{
					selState:'全部',
					selStateNum:'',
					patientName:'',
					phone:'',
					barCode:'',
					orderList:[],//订单列表
					orderTip:0,
					orderIds:[],//未确认订单id集合数
					show:false,
					urlArr:[],//报告地址
					confirm:0,//是否确认订单
					isTip:false,
					menuName:'',//判断哪个地方进入
					confirmList:[],
					unConfirmList:[],
					userId:'',
					fromPage:'',//订单页有无确认订单
					smsCode:''
				},
				mounted(){
//					var vConsole = new VConsole();
					this.init();
					this.getUrl();
					this.getPages();
				},
				filters:{
					format:function (val) {
						switch(val){
							case '0':
								return '临时订单';
								break;
							case '1':
								return '检验中';
								break;
							case '2':
								return '送检中';
								break;
							case '3':
								return '检验中';
								break;
							case '4':
								return '生成报告';
								break;
							case '5':
								return '检验中';
								break;
							case '6':
								return '送检中';
								break;
							case '7':
								return '检验中';
								break;
							case '8':
								return '生成报告';
								break;
							case '9':
								return '送检中';
								break;
							case '10':
								return '检验中';
								break;
							case '11':
								return '生成报告';
								break;
							case '12':
								return '已取消';
								break;
							case '13':
								return '检验中';
								break;
							case '14':
								return '部分报告已出';
								break;
							case '15':
								return '部分生成报告';
								break;
							case '16':
								return '部分生成报告';
								break;
							default:
								return state;
								break;
						}
					}
				},
				methods:{
					init(){
						let _this=this;
						/*调用微信接口配置location.href.split('#')[0]*/
						AT.muiAjax('/partner-sale/partnerSale/wxConfig','post',{url:location.href.split('#')[0],appId:'wx50a81908477971c2'},function(res){
							wx.config({
								//debug: true,
								appId:res.appId,
								timestamp:res.timestamp,
								nonceStr:res.nonceStr,
								signature:res.signature,
								jsApiList:['previewImage']
							});
						});
						//获取userID
						AT.muiAjax('/partner-sale/statistics/getHome','post',{},function(res){
							console.log(res);
							_this.userId = res.id;
						});
					},
					getUrl(){
						let _this=this;
						var url = decodeURI(location.search); //获取url中"?"符后的字串    
						var theRequest = new Object();  
						console.log(url);
					   	if (url.indexOf("?") != -1) {   
					      var str = url.substr(1);  
//					      console.log(str);
					      strs = str.split("&");  
					      for(var i = 0; i < strs.length; i ++) {   
					         theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]);   
					      } 
					   	}   
					   	_this.patientName = theRequest.name;
					   	_this.phone = theRequest.phone;
					   	_this.barCode = theRequest.barCode;
					   	_this.smsCode = theRequest.smsCode;
					   	_this.fromPage = theRequest.fromPage;
					   	console.log(_this.barCode);
					},
					getPages(){
						/*获取页面*/
						let _this=this;
						let dataArr = {};
						if(_this.smsCode==''){
							dataArr = {
								patientName:_this.patientName,
								specimenBarCode:_this.barCode,
								phone:_this.phone
							}
						}else{
							dataArr = {
								patientName:_this.patientName,
								specimenBarCode:_this.barCode,
								phone:_this.phone,
								smsCode:_this.smsCode
							}
						}
						//加载页面数据
						mui.ajax({
							url:AT.baseUrl+"/partner-sale/orderAndReport/list",
							data:dataArr,
							dataType:'json',
							type:'post',
							timeout:10000,//超时时间设置为10秒；
							headers:{'Content-Type':'application/json'},
							success:function(data){
								console.log(data);
								if(data.code=='0'){
									_this.orderList = data.data;
								}else{
									console.log('查询失败！');
									mui.confirm(data.msg,'',['确定'],function(con){
										if(con.index===0){
//											mui.toast(data.msg);
											location.href = "reportSearch.html";
										}
									});
								}
						    }
						});
					},
					reportDetail(id){
						location.href = "orderDetail.html?id="+id+"&userId="+this.userId;
					}
				}
			})
		</script>
	</body>

</html>